Skip to content

fix: replace simulated quota exhaustion with short token backoff#419

Open
shellus wants to merge 2 commits intochenyme:mainfrom
shellus:fix/cf-refresh-token-recovery
Open

fix: replace simulated quota exhaustion with short token backoff#419
shellus wants to merge 2 commits intochenyme:mainfrom
shellus:fix/cf-refresh-token-recovery

Conversation

@shellus
Copy link
Copy Markdown
Contributor

@shellus shellus commented Apr 2, 2026

Summary

修复 token 因本地错误状态机而长期卡在 cooling/quota=0 的问题,并补强 cf_refresh 后的恢复链路。

Changes

  • 保留并扩展 cf_refresh 修复,避免后台循环异常退出,并在 cf_clearance 刷新成功后触发一次受限的 cooling token 刷新
  • 将 429 处理改为短退避,不再把本地 quota 直接清零,也不再把 remainingQueries 当作本地硬耗尽配额持续递减
  • 移除请求路径上的按需 token 恢复逻辑,恢复工作统一放回后台调度
  • 新增回归测试,覆盖短退避恢复、后台恢复和请求路径不触发按需恢复

Verification

  • cd /data/compose/grok2api/source && PYTHONPATH=/data/compose/grok2api/source proxy-env uv run --with pytest pytest -q
  • 本地 Docker 重新构建并重启后,已验证 /v1/models/v1/admin/tokens/v1/chat/completions 均可正常返回

@shellus shellus changed the title fix: recover cooling tokens after cf_refresh fix: replace simulated quota exhaustion with short token backoff Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant